package main
import "fmt"

type Animal interface {
	SetName(string)
	GetName()string
}

type Dog struct {
	Name string
}

func (d *Dog) SetName(name string) {
	d.Name = name
}
func (d Dog) GetName() string {
	return d.Name
}

type Cat struct {
	Name string
}

func (c *Cat) SetName(name string) {
	c.Name = name
}
func (c Cat) GetName() string {
	return c.Name
}

func main() {
	var a Animal = &Dog{}
	a.SetName("dog")
	fmt.Println(a.GetName())

	var b Animal = &Cat{}
	b.SetName("cat")
	fmt.Println(b.GetName())
}
